package net.huashitong.supervision.insideDuCha.dao;

import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;
import com.sirdc.modules.utils.StringUtils;
import net.huashitong.supervision.insideDuCha.entity.InsideMainTaskEntity;
import net.huashitong.supervision.insideDuCha.filter.InsideMainTaskFilter;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class InsideMainTaskDao extends StringDao<InsideMainTaskEntity> {


    /**
     * 主任务 的获取
     * @param filter
     * @return
     */
    public List<InsideMainTaskEntity> getListMainTask(InsideMainTaskFilter filter)
    {
        GenericQuery query = createQuery("obj");
        if(StringUtils.isNotBlank(filter.getDeptId())){

            query.append("and obj.deptId=:deptId").setParam("deptId",filter.getDeptId());
        }
        if(StringUtils.isNotBlank(filter.getCreateUser()))
        {
            query.append("and obj.createUser=:createUser").setParam("createUser",filter.getCreateUser());

        }
        return query.listResult();
    }

}
